package com.curry.android.view.gridview;

import java.util.List;

import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

public class ViewPager_GridView_Adapter extends PagerAdapter {

	private List<View> mAllViews;
	
	public ViewPager_GridView_Adapter(List<View> list){
		this.mAllViews=list;
	}


	@Override
	public int getCount() {
		return mAllViews.size();
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1;
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		((ViewPager) container).removeView((View) object);
	}

	@Override
	public Object instantiateItem(View container, int position) {
		((ViewPager) container).addView(mAllViews.get(position),
				new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT));
		return mAllViews.get(position);
	}

}
